<?php
/**
 * 零钱明细
 * Date: 2023/5/09
 * Time: 11:33
 */

namespace App\frontend\models;


use App\common\models\BaseModel;
use Illuminate\Support\Facades\DB;

/**
 * Class DetailsPocketMoneyModel
 * @package app\common\models
 */
class DetailsPocketMoneyModel extends BaseModel
{

    public  $table = 'details_pocket_money';


    static $_instance; //本类的实例

    public static function getInstance()
    {
        if (!(self::$_instance instanceof self)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }


    /**
     * 根据条件，列表
     * @param $condition
     * @return array
     */
    public function getList($condition,$page,$limit)
    {
        $data = [];
        if (empty($condition)) {
            return $data;
        }
        $data = DB::table($this->table)->where($condition)->orderBy('create_time', 'desc')->apiPaginate($limit, ['*'], 'page', $page)->toarray();
        return $data;
        return $data;
    }


    /**
     * 保存
     * @param $data
     * @return int|void
     */
    public function add($data)
    {
        $data = DB::table($this->table)->insert($data);
        return $data;
    }



}
